
<template>
	<div class="index">

		<div class="center">
			<left></left>
			<div class="right">
          <top></top>
          <!-- <div class="hei10"></div>
          <div class="where" style="background: #fff; padding: 10px 30px; font-size: 14px; color: #595959;">当前位置：分销后台><router-link to="/old_Other">分销商发展历史订单</router-link></div>
          --><div class="hei10"></div>
				<div class="o_ul">
					<router-link class="o_li " to="/order_question">我的订单</router-link>
					<router-link class="o_li " to="/order_question/orderOther">分销商发展订单</router-link>
					<router-link class="o_li" to="/order_question/old_dingdan">历史订单查询</router-link>
					<router-link class="o_li act " to="/order_question/old_Other">分销商发展历史订单</router-link>
				</div>
				<div class="processing">
					<div class="pro_top">
						<el-form ref="form" @submit.native.prevent :model="search" label-width="110px">

							<div class="orderflex">
								<!-- <el-form-item label="商品筛选">
                                        <el-select v-model="search.product_ids" multiple filterable collapse-tags remote reserve-keyword placeholder="请选择" >
                                            <el-option v-for="item in search.prolist" :key="item.id" :label="item.title" :value="item.id"></el-option>
                                        </el-select>
                                    </el-form-item> -->
								<el-form-item label="订单状态">
									<el-select v-model="search.status" clearable placeholder="请选择订单状态">
										<el-option :label="item.label" :value="item.value" v-for="(item,index) in peizhis.order_status" :key="index"></el-option>
									</el-select>
								</el-form-item>
								<el-form-item label="分销商">
									<el-select v-model="search.child_shop_id" filterable placeholder="请选择分销商">
										<el-option v-for="item in idslist" :key="item.child_shop_id" :label="item.name"
											:value="item.child_shop_id"></el-option>
									</el-select>

								</el-form-item>
								<el-form-item label="身份证号" style="position: relative;">
									<el-input v-model="search.id_num"></el-input>

                  <el-tooltip class="item" effect="dark" content="批量查询" placement="top-start">
                  	<span
                  		style="position: absolute; right: 10px; top: 0px; color: #1989FA; font-size: 16px; cursor: pointer;"
                  		@click="duoxuanlogx = true">
                  		<i class="el-icon-circle-plus"></i>
                  	</span>
                  </el-tooltip>

								</el-form-item>
								<el-form-item label="生产号码">
									<el-input v-model="search.plan_mobile_produced"></el-input>
                  <el-tooltip class="item" effect="dark" content="批量查询" placement="top-start">
                  	<span
                  		style="position: absolute; right: 10px; top: 0px; color: #1989FA; font-size: 16px; cursor: pointer;"
                  		@click="duoschm = true">
                  		<i class="el-icon-circle-plus"></i>
                  	</span>
                  </el-tooltip>
								</el-form-item>
							</div>
							<div class="orderflex">

								<el-form-item label="外部订单编号">
									<el-input v-model="search.source_id"></el-input>
								</el-form-item>
								<el-form-item label="订单ID">
									<el-input v-model="search.orderid"></el-input>
                  <!-- 下周上 -->
                  <el-tooltip class="item" effect="dark" content="批量查询" placement="top-start">
                  	<span
                  		style="position: absolute; right: 10px; top: 0px; color: #1989FA; font-size: 16px; cursor: pointer;"
                  		@click="duoxuanlog = true">
                  		<i class="el-icon-circle-plus"></i>
                  	</span>
                  </el-tooltip>
								</el-form-item>
								<!-- <el-form-item label="商品编码">
									<el-input v-model="search.product_sku"></el-input>
								</el-form-item> -->
                <el-form-item label="商品编码:" style="position: relative;">
                  <!-- <el-input v-model="form.good_sku"></el-input> -->
                  <el-select v-model="form.pages_ids" clearable multiple collapse-tags filterable
                  	placeholder="请选择">
                  	<el-option v-for="item in allprolist2" :key="item.id" :label="item.fetch_code"
                  		:value="item.id"></el-option>
                  </el-select>
                  <span
                  	style="position: absolute; right: -20px; top: 0px; color: #1989FA; font-size: 16px; cursor: pointer;"
                  	@click="quanxuanyong">
                  	<i class="el-icon-circle-plus"></i>
                  </span>
                </el-form-item>
								<el-form-item label="收件人电话">
									<el-input v-model="search.address_mobile"></el-input>
								</el-form-item>
							</div>
							<div class="orderflex">
								<el-form-item label="平台创建时间">
									<el-date-picker style="width: 470px;" v-model="search.time"
										value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" range-separator="——" :default-time="['00:00:00', '23:59:59']"
										start-placeholder="开始日期" end-placeholder="结束日期">
									</el-date-picker>
								</el-form-item>
								<el-form-item label="状态变更时间">
									<el-date-picker style="width: 470px;" v-model="search.timefix"
										value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" range-separator="——" :default-time="['00:00:00', '23:59:59']"
										start-placeholder="开始日期" end-placeholder="结束日期">
									</el-date-picker>
								</el-form-item>
							</div>
							<div class="orderflex ordersub">
                <el-button type="primary" @click="chongzhisousuo" style="padding: 9px 30px;">重置</el-button>
								<el-button type="danger" @click="dosearch()">查询</el-button>
								<!-- <el-button type="danger" @click="daochutishi = true" :loading="daochuing">{{daochuingz}}</el-button> -->
								<!-- <el-button  type="danger" :loading="daochuing" v-if="func_I02" @click="daochu()">{{daochuingz}}</el-button> -->
                <el-button type="danger" @click="daochulogskai" style="margin-right: 20px !important;" :loading="daochuing">{{daochuingz}}
                </el-button>
							</div>
						</el-form>
						<div v-if="daochutishi" style=" border: 1px #EAEAEA solid; margin: 0 20px; padding: 10px 10px; background: #fffcf3;">
						               <div style="font-size: 14px; margin-bottom: 10px; font-weight: bold; color: #333333;">为了给您提供更好的查询性能以及体验，我们对导出功能进行了更改：</div>
						               <div style="padding-left: 20px; font-size: 14px; color: #666666; ">1.超出6个月的订单请前往历史订单查询</div>
						               <div style="padding-left: 20px; font-size: 14px; color: #666666; display: flex;  justify-content: space-between; align-items: center;" >
						                 <div>2.我们将为您保留已生成的数据，便于您随时导出使用</div>
						                 <div>
						                   <el-button size="mini" type="primary" @click="xiazai">生成报表</el-button>
						                   <el-button size="mini" type="primary" @click="goxiazai">查看已经生成的报表</el-button>
						                 </div>
						                </div>
						          </div>
					</div>
					<div class="pro_center"  v-loading="loading">
						<div class="newlist newflex" style="margin-bottom: 10px;">
							<div class="newleft">

								<div class="newthli" style="position: relative;">
                  <div  @click="shunxu" style="cursor: pointer; position: absolute; right: -20px; top: 0;">
                  	时间排序
                  	<i class="el-icon-top" style="color: #2974FF;" v-if="!desc"></i>
                  	<i style="color: #2974FF;" class="el-icon-bottom" v-if="desc"></i>
                  </div>
                  订单信息
                </div>

								<div class="newthli">收件人管理</div>
								<div class="newthli" style="flex:0.7">备注&失败原因</div>
								<div class="newthli" style="flex:0.7">订单状态</div>
								<div class="newthli" style="flex:0.7">生产信息</div>
                <div class="newthli" style="flex:0.7">操作</div>
							</div>
						</div>
						<div v-if="orderlist == ''" style="text-align: center; color: #ccc; font-size: 16px; padding: 30px;">
										无检索结果
									</div>

						<div class="newlist newlistbor" v-for="item in orderlist" :key="item.id" v-loading="loading">
							<div class="newh">
								<div class="newleft">

									<div class="newhli">
										订单ID：{{item.id}}
										<i class="el-icon-document-copy"
											style="color: #077ECE; font-size: 16px; margin-left: 10px; cursor: pointer;"
											@click="copy(item.id)"></i>
									</div>
									<div class="newhli" style="display:flex">
										订单来源：{{item.source}}
									</div>
									<div class="newhli">
										外部订单编号：{{item.source_id}}
										<i class="el-icon-document-copy"
											style="color: #077ECE; font-size: 16px; margin-left: 10px; cursor: pointer;"
											@click="copy(item.source_id)"></i>
										<span v-if="item.source_id.indexOf('-C') != -1">
											<el-popover placement="top-start" width="200" trigger="hover"
												content="该订单为拆分订单（电商平台购买数量大于2时自动拆分的订单）针对该订单的修改信息、加急、标旗备注、外呼已联系操作都将自动同步修改到其关联的拆分订单上。">
												<span slot="reference">
													<img src="../../../static/img/chai.png"
														@click="searchbrother(item.real_source_id)"
														style="width: 20px; margin-left: 10px; position: relative; top: 4px; cursor: pointer;" />
												</span>
											</el-popover>
										</span>
									</div>
									<div class="newhli">平台创建时间：{{item.created_at}}</div>
                  <el-tooltip popper-class="tooltip" effect="dark" placement="top">
										<div slot="content">{{item.memo}}</div>
										<div>
											<span @click="choosecolorid(item.id)"
												:style="{color:item.flag,fontSize:25+'px'}"
												class="iconfont icon-flag-fill"></span>
										</div>
									</el-tooltip>
								</div>
								<div class="newright">
									<el-tooltip v-if="item.complaint_job_id" popper-class="tooltip" effect="dark" placement="top">
                  	<div slot="content">该订单被用户投诉过，点击可查看详情</div>
                  	<div @click="todetail_s(item.complaint_job_id,item.complaint_job_status)" class="t_su">诉</div>
                  </el-tooltip>
								</div>
							</div>

							<div class="newb">
								<div class="newt1">
                  <div style="padding:15px;">
                    <div class="newtitle">商品名称:<span @click="todetail(item.parent_page_id)" style="cursor:pointer;color:#197cff">{{item.my_gname}}</span></div>
                    <div class="newcode">商品编码:{{item.my_gsku}}</div>
                    <div class="newcode" v-if="item.plan_mobile != 0">购买号码:{{item.plan_mobile}}</div>
                    <div class="newcode" v-if="item.plan_mobile == 0">购买号码:无</div>
                    <div class="newcode">购买数量:{{item.amount}}</div>
                    <div class="newcode">
                      <div style="display: flex;">
                        <div>供应商:</div>
                       <!-- {{item.supplier_product_sku}} -->
                        <dianjichakan :id="item.id"></dianjichakan>
                      </div>

                    </div>
                  </div>

								</div>
								<div class="newt2">
                  <div style="padding:15px;">
                    <div class="newcar">
                    	<span style="margin-right: 20px;">证件姓名：{{item.id_card_name}}</span>
                    	收件人：{{item.address_name}}
                    </div>
                    <div class="newcar">
                    	证件号码：{{item.id_card_num}}
                    	<span class="seephoto" style="margin-left: 10px;"
                    		@click="seephoto(item)" v-if="user.id != 304673 && user.id != 304672 && user.id != 50481">查看证件</span>
                        <span class="seephoto" style="margin-left: 10px;"
                        	@click="jiemi(item)"  v-if="user.id != 304673 && user.id != 304672">查看完整信息</span>
                    </div>
                    <div class="newcar">联系电话：{{item.address_mobile}}</div>
                    <div class="newcar">
                    	收货地址：{{item.address_province}}{{item.address_city}}{{item.address_district}}{{item.address}}
                    </div>
                  </div>

								</div>
								<div class="newt3" style="flex:0.7">
                  <div style="padding:15px;">
                    <el-tooltip effect="dark" popper-class="tooltip" placement="top">
                    	<div slot="content">
                        <div v-for="item2 in item.reason">
                          {{item2}}
                        </div>
                      </div>
                    	<div style="max-height:100px; overflow: hidden;">
                        <div v-for="item2 in item.reason">
                          {{item2}}
                        </div>
                      </div>
                    </el-tooltip>
                  </div>

								</div>
								<div class="newt4" style="flex:0.7">
                  <div style="padding:15px;">
                    <div class="newcar">{{item.status_name}}</div>
                    <!-- <div class="newcar2" @click="seememo(item.seller_memo)">操作记录</div> -->
                    <div class="newcar">激活状态:{{item.active_name}}</div>
                  </div>

								</div>
								<div class="newt5"  style="flex:0.7">
                  <div style="padding:15px;">
                    <div class="newcar">生产号码:</div>
                    <div class="newcar" v-if="item.plan_mobile_produced != null">
                    	{{item.plan_mobile_produced}}</div>
                    <div class="newcar" v-if="item.plan_mobile_produced == null">无</div>
                    <div class="newcar" v-if="item.tracking_company != ''">{{item.tracking_company}}
                    </div>
                    <div class="newcar" v-if="item.tracking_number != ''">{{item.tracking_number}}</div>
                    <!-- <div class="newcar2" @click="seememo(item.seller_memo)">操作记录</div> -->
                  </div>

								</div>
                <div class="newt5" style="flex:0.7">
									<div style="padding: 15px;"  >
										<el-button type="text" @click="opents(item.id)">创建投诉工单</el-button>
									</div>

								</div>
							</div>
						</div>

						<div class="orderlist">

							<div class="orderfanye">
								<el-pagination background :page-size="search.size" :current-page="search.page"
									@current-change="fanye" layout="prev, pager, next" >
								</el-pagination>
							</div>
						</div>
					</div>
					<el-dialog title="查看照片" :visible.sync="seephotolog" :close-on-click-modal="false" width="1254px">
						<div v-loading="seephotoing">
							<div class="logflex">
								<div class="proimg" v-if="choose.face != ''"><img :src="choose.face" /></div>
								<div class="proimg" v-if="choose.face == ''">暂无照片</div>
								<div class="proimg" v-if="choose.back != ''"><img :src="choose.back" /></div>
								<div class="proimg" v-if="choose.back == ''">暂无照片</div>
								<div class="proimg" v-if="choose.hand != ''"><img :src="choose.hand" /></div>
								<div class="proimg" v-if="choose.hand == ''">暂无照片</div>
							</div>
						</div>
						<div slot="footer" class="dialog-footer">
							<el-button type="primary" size="small" @click="seephotolog = false">确 定</el-button>
						</div>
					</el-dialog>
					<el-dialog title="查看操作记录" :close-on-click-modal="false" :visible.sync="seememolog" width="800px">
						<div v-html="memo" style="line-height: 30px;"></div>
						<span slot="footer" class="dialog-footer">
							<el-button type="primary" size="small" @click="seememolog = false">好的</el-button>
						</span>
					</el-dialog>
					<el-dialog title="请输入导出密码" :visible.sync="mimalog" width="400px" :close-on-click-modal="false">
					          <div style="padding-right: 30px;">
					               <el-input v-model="mima" show-password placeholder="请输入导出密码"></el-input>
					          </div>
					          <div slot="footer" class="dialog-footer">
					            <el-button size="medium" type="primary" @click="mimaqueren">确 定</el-button>
					            <el-button size="medium" type="text" @click="mimachongzhilog = true">重设密码</el-button>
					          </div>
					    </el-dialog>

					    <el-dialog title="请设置导出密码" :visible.sync="mimasetlog" width="400px" :close-on-click-modal="false">
					<!--          <div style="padding-right: 30px; margin-bottom: 20px;">
					               <el-input v-model="mimashoujihao" disabled placeholder="请输入验证码"></el-input>
					          </div>
					          <div style="padding-right: 30px; margin-bottom: 20px; position: relative;">
					               <el-input v-model="mimacode"  placeholder="请输入验证码"></el-input>
					               <el-button style="padding: 9px 30px; position: absolute; right: 31px; top: 1px;"  type="danger" @click="getcode" :disabled="jinyong" size="mini">{{tishi}}</el-button>
					          </div> -->
					          <div style="padding-right: 30px; margin-bottom: 20px;">
					               <el-input v-model="mimaset" show-password placeholder="请设置导出密码"></el-input>
					          </div>
					          <div style="padding-right: 30px;">
					               <el-input v-model="mimaset2" show-password placeholder="请再次输入确认导出密码"></el-input>
					          </div>
					          <div style="color: #DF3434; margin-top: 10px;">为了您的订单数据安全，即日起所有批量导出数据的出口需输入导出密码才可导出，请与联系店铺负责人协商设置该密码</div>
					          <div slot="footer" class="dialog-footer">
					            <el-button size="medium"  @click="mimasetlog = false">取 消</el-button>
					            <el-button size="medium"  type="primary" @click="mimasetqueren">确 定</el-button>
					          </div>
					    </el-dialog>

					    <el-dialog title="重设导出密码" :visible.sync="mimachongzhilog" width="400px" :close-on-click-modal="false">
					          <div style="padding-right: 30px; margin-bottom: 20px;">
					               <el-input v-model="mimashoujihao" disabled placeholder="请输入验证码"></el-input>
					          </div>
					          <div style="padding-right: 30px; margin-bottom: 20px; position: relative;">
					               <el-input v-model="mimacode"  placeholder="请输入验证码"></el-input>
					               <el-button style="padding: 9px 30px; position: absolute; right: 31px; top: 1px;"  type="danger" @click="getcode" :disabled="jinyong" size="mini">{{tishi}}</el-button>
					          </div>
					          <div style="padding-right: 30px; margin-bottom: 20px;">
					               <el-input v-model="mimaset" show-password placeholder="请输入新密码"></el-input>
					          </div>
					          <div style="padding-right: 30px;">
					               <el-input v-model="mimaset2" show-password placeholder="请确认新密码"></el-input>
					          </div>
					          <div slot="footer" class="dialog-footer">
					            <el-button size="medium" @click="mimachongzhilog = false">取 消</el-button>
					            <el-button size="medium" type="primary" @click="mimaqueren2">确 定</el-button>
					          </div>
					    </el-dialog>
				</div>
			</div>
		</div>
    <el-dialog title="多个订单ID搜索" :visible.sync="duoxuanlog" :close-on-click-modal="false" width="600px">
    	<div>
    		<el-input type="textarea" :rows="10" placeholder="一行一个，可直接粘贴excel纵列数据" v-model="duoxuanids"></el-input>
    	</div>
    	<div slot="footer" class="dialog-footer">
    		<el-button type="primary" size="small" @click="search2">搜索</el-button>
    	</div>
    </el-dialog>
    <el-dialog title="多个生产号码搜索" :visible.sync="duoschm" :close-on-click-modal="false" width="600px">
    	<div>
    		<el-input type="textarea" :rows="10" placeholder="一行一个，可直接粘贴excel纵列数据" v-model="duoschminput"></el-input>
    	</div>
    	<div slot="footer" class="dialog-footer">
    		<el-button type="primary" size="small" @click="searchduoschm">搜索</el-button>
    	</div>
    </el-dialog>
    <el-dialog title="多个身份证号搜索" :visible.sync="duoxuanlogx" :close-on-click-modal="false" width="600px">
    	<div>
    		<el-input type="textarea" :rows="10" placeholder="一行一个，可直接粘贴excel纵列数据" v-model="duoxuanidsx2"></el-input>
    	</div>
    	<div slot="footer" class="dialog-footer">
    		<el-button type="primary" size="small" @click="search2x">搜索</el-button>
    	</div>
    </el-dialog>
    <bianmaquanxuan ref="bianmaquanxuan" @bianmaquanxuans="bianmaquanxuans" v-if="bianmaquanxuanshow"></bianmaquanxuan>
		<!-- <foot></foot> -->
    <!-- 投诉弹窗 -->
		<tousuwindow :isshowwindow="isshowwindow" @creategd="creategd" @creategdhide="creategdhide" :tousuid="tousuid" />
    <daochulogs v-if="daochulogsall.show" ref="daochulogs" @daochulogsguanbi="daochulogsguanbi"  :type="2"></daochulogs>
	</div>
</template>

<script>
  import daochulogs from "./zujian/daochu.vue";
  import axios from "axios";
  import top from '@/components/top.vue'
  import left from '@/components/left.vue'
  import foot from '@/components/foot.vue'
  import dianjichakan from "./zujian/dianjichakan2.vue";
  import bianmaquanxuan from "./zujian/bianmaquanxuan.vue";
  import tousuwindow from "./tousuwindow.vue";
  import {
    regionData,
    CodeToText,
    TextToCode
  } from 'element-china-area-data'
  import moment from 'moment'

  export default {
    components: {
      "left": left,
      "top": top,
      "foot": foot,
      dianjichakan,
      bianmaquanxuan,
      tousuwindow,daochulogs

    },
    name: 'orderOther',
    data() {
      return {
        daochulogsall:{
          show:false,
        },
        seememolog: false,
        memo: "",
        daochuing: false,
        daochuingz: "批量导出",
        colorname: "gray",
        show: {
          id: true,
          source_id: false,
          created_at: true,
          sp_name: false,
          product_name: true,
          sku: true,
          status: true,
          number: false,
          id_card_name: true,
          id_card_num: true,
          address: false,
          address_mobile: false,
          address_name: false,
          channel_shop: false,
          merchant_shop: false,
          plan_mobile: false,
          plan_mobile_produced: true,
          region_c: false,
          seller_memo: false,
          tracking_number: false,
          reason: false
        },
        searchelse: false,
        fixstatusid: "",
        fixreasons: "",
        fixid: "",
        fixitemnum: "",
        fixsku: "",
        fixskuid: "",
        backproreason: "",
        shengchannum: "",
        yundannum: "",
        fixordermes: {
          city: "",
          id: "",
          address_name: "",
          id_card_name: "",
          id_card_num: "",
          address_mobile: "",
          address_province: "",
          address_city: "",
          address_district: "",
          address: "",
          plan_mobile_produced: "",
          tracking_number: ""
        },
        value2: ["ID", "下单时间", "商品名称", "订单状态", "生产号码", "证件姓名", "身份证号"],

        address: "",
        options: regionData,
        pipeipro: "",
        shaixuanother: [
          "ID", "外部订单编号", "下单时间", "商品名称", "购买号码", "证件姓名", "身份证号", "收货地址",
          "联系电话", "收货人", "生产号码", "操作记录", "物流单号", "生产备注"
        ],

        loading: false,
        fixstatuslog: false,
        seephotolog: false,
        seephotoing: false,
        fixprolog: false,
        backorderlog: false,
        probacklog: false,
        fastlog: false,
        fixorderlog: false,
        backprolog: false,
        whiteprolog: false,
        choose: {
          face: "",
          back: "",
          hand: "",
          id: "",
          orderid: ""
        },
        orderlist: [],
        idslist: [],
        search: {
          child_shop_id: "",
          share_name: "",
          plan_mobile_produced: "",
          prolist: [],
          channel_id: "",
          product_ids: "",
          id_name: "",
          order_id: "",
          number: "",
          id_num: "",
          status: "",
          phone: "",
          buy_number: "",
          source_id: "",
          source: "",
          product_sku: "",
          merchant_name: "",
          sp_id: "",
          page: 1,
          size: 20,
          total: 0,
          product_name: "",
          fetch_code: "",
          orderstatus: "",
          card_num: "",
          time2: "",

          time: [],
          start: "",
          end: "",

          timefix: [],
          starttime: "",
          endtime: "",

          orderid: "",
          number: "",
          card_name: "",
          qudaolist: [],
          color: "",
          address_mobile: ""
        },
        fixchooselist: {
          city: ""
        },

        show040101: false,
        show040102: false,
        show040103: false,
        show040105: false,
        show040106: false,
        show040107: false,
        show040108: false,
        show040104: false,

        child_shop_id: "",

        orderby: 1,
        desc: true,

        mimalog: false,
        mima: "",
        mimaid: "",
        mimasetlog: false,
        mimaset: "",
        mimaset2: "",
        mimachongzhilog: false,
        mimashoujihao: "",
        mimacode: "",
        count: 60,
        tishi: "获取验证码",
        jinyong: false,
        daochutishi: false,

        allprolist3:[],
        allprolist2:[],
        form:{
          pages_ids:[]
        },
        duoxuanlog3:false,
        bianmaquanxuanshow:false,
        //是否展示投诉弹窗
        isshowwindow:false,
        //投诉订单id
        tousuid:'',
        shop_id:"",
        func_U:false,
        user:"",

        duoxuanlog: false,
        duoschm:false,
        duoschminput:'',
        duoschminput2:'',
        duoxuanids: "",
        duoxuanids2: "",

        duoxuanidsx:"",
        duoxuanidsx2:"",
        duoxuanlogx:false

      }
    },
    created() {
      //现获取分销商
      this.getidslist()
      if (this.$route.query.id) {
        this.search.child_shop_id = this.$route.query.id
      }
      //导出密码
      if (localStorage.getItem("daochumima") != null) {
        this.mima = localStorage.getItem("daochumima")
      }

      //第一次加载设置一个默认的时间一个月  不然太卡
      // this.search.end = moment().add(1, 'days').format("YYYY-MM-DD 00:00:00");
      // this.search.start = moment().subtract(7, 'days').format("YYYY-MM-DD 00:00:00");

      // this.search.time = [this.search.start,this.search.end]

      // this.getlist()

      //权限问题
      var user = JSON.parse(localStorage.getItem('USER'));
	  this.user = user
      this.user_func = user.functions
      for (var i in this.user_func) {
        var func_number = this.user_func[i].code
        if (func_number.indexOf("I02") >= 0) {
          this.func_I02 = true
        }
        if (func_number.indexOf("U") >= 0) {
					this.func_U = true;
				}
      }

      //获取所有产品
      axios.get("/api/gth/order-pages?_page_size=3000")
      	.then(response=> {
      		if (response.data.msg.code == 0) {
      			this.allprolist2 = response.data.data.data
      			this.allprolist3 = response.data.data.data
            this.search.prolist = response.data.data.data
      		}
      	})

    },
    mounted() {
        //获取店铺id
        axios.get("/api/gth/user/shop").then(response => {
          if (response.data.msg.code == 0) {
          this.shop_id = response.data.data.shop_id;
          } else {
          this.$message.error(response.data.msg.info);
          }
        });
      //获取产品列表
      axios.get('/api/gth/order-pages?_page_size=1000')
        .then(response => {
          this.search.prolist = response.data.data.data
        })

    },
    methods: {
      daochulogskai:function(){
        // this.daochulogsall.id = val.id
        this.daochulogsall.show = true
        this.$nextTick(()=>{
          this.$refs.daochulogs.chushihua()
        })
      },
      daochulogsguanbi:function(item){
        this.daochu(item)
      },
      search2x: function() {
      	this.duoxuanidsx = this.duoxuanidsx2.split(/\n/)
      	for (let i in this.duoxuanidsx) {
      		this.duoxuanidsx[i] = this.duoxuanidsx[i].trim()
      	}
      	this.search.page = 1;
      	this.loading = true;
      	this.getlist();
      	this.duoxuanlogx = false
      },
      searchduoschm: function() {
        this.duoschminput2 = this.duoschminput.split(/\n/)
        for (let i in this.duoschminput2) {
          this.duoschminput2[i] = this.duoschminput2[i].trim()
        }
        this.search.page = 1;
        this.loading = true;
        console.log(this.duoschminput2)
        this.getlist();
        this.duoschm = false
      },
      search2: function() {
        this.duoxuanids2 = this.duoxuanids.split(/\n/)
        for (let i in this.duoxuanids2) {
          this.duoxuanids2[i] = this.duoxuanids2[i].trim()
        }
        this.search.page = 1;
        this.loading = true;
        this.getlist();
        this.duoxuanlog = false
      },

      quanxuanyong:function(){
        this.bianmaquanxuanshow = true
        this.$nextTick(()=>{
          this.$refs.bianmaquanxuan.duoxuanlog2 = true
        })

      },
      bianmaquanxuans:function(data){
        console.log(data)
        this.form.pages_ids = data
      },

      chongzhisousuo:function(){
        this.search = {
          child_shop_id: "",
          share_name: "",
          plan_mobile_produced: "",
          prolist: [],
          channel_id: "",
          product_ids: "",
          id_name: "",
          order_id: "",
          number: "",
          id_num: "",
          phone: "",
          buy_number: "",
          source_id: "",
          source: "",
          product_sku: "",
          merchant_name: "",
          sp_id: "",
          page: 1,
          size: 20,
          total: 0,
          product_name: "",
          fetch_code: "",
          orderstatus: "",
          card_num: "",
          time2: "",
          status:"",
          time: [],
          start: "",
          end: "",

          timefix: [],
          starttime: "",
          endtime: "",

          orderid: "",
          number: "",
          card_name: "",
          qudaolist: [],
          color: "",
          address_mobile: ""
        }
        this.form.pages_ids = []

        this.duoxuanids = ''
        this.duoxuanids2 = ''
        this.duoschminput = ''
        this.duoschminput2 = ''
        this.duoxuanidsx = ''
        this.duoxuanidsx2 = ''
      },
      jiemi:function(item,index){

        this.$set(item,'id_card_name',this.decrypt(item.encrypt_id_card_name))
        this.$set(item,'id_card_num',this.decrypt(item.encrypt_id_card_num))
        this.$set(item,'address_name',this.decrypt(item.encrypt_address_name))
        this.$set(item,'address_mobile',this.decrypt(item.encrypt_address_mobile))
        this.$set(item,'address',this.decrypt(item.encrypt_address))

      },
      goxiazai: function() {
        // this.$router.push({
        //   path:'/order_export2'
        // })
        let routeData = this.$router.resolve({
          path: '/order_export2'
        });
        window.open(routeData.href, '_blank');
      },
      //重置密码确认
      mimaqueren2: function() {
        if (this.mimaset != this.mimaset2) {
          this.$message.error("输入的密码不一致");
          return false
        }
        axios.post("/api/plan-market/shop/pwd", {
            mobile: this.mimashoujihao,
            sms_code: this.mimacode,
            password: this.mimaset
          })
          .then(response => {
            if (response.data.msg.code == 0) {
              this.$message.success("密码设置成功");
              this.mimachongzhilog = false
            } else {
              this.$message.error(response.data.msg.info);
            }
          })
      },
      //获取验证码
      getcode: function() {
        var that = this;
        var params = new URLSearchParams();
        params.append('mobile', this.mimashoujihao);
        axios.post('/api/auth/sms_code', params)
          .then(response => {
            if (response.data.msg.code == 0) {
              this.$message({
                message: '验证码已发送！',
                type: 'success'
              });
              that.daojishi()
            } else {
              this.$message.error(response.data.msg.info);
            }
          })
      },
      //倒计时功能
      daojishi: function() {
        var interval;
        interval = window.setInterval(() => {
          if (this.count <= 0) {
            window.clearInterval(interval)
            this.tishi = "获取验证码",
              this.jinyong = false
            this.count = 60
          } else {
            this.count -= 1;
            this.tishi = this.count + "秒重新获取"
            this.jinyong = true
          }
        }, 1000);
      },
      //获取手机号发验证码
      getshoujihao: function() {
        axios.get("/api/gth/my/shop/mobile")
          .then(response => {
            if (response.data.msg.code == 0) {
              this.mimashoujihao = response.data.data
            } else {
              this.$message.error(response.data.msg.info);
            }
          })
      },
      //密码设置
      mimasetqueren: function() {
        if (this.mimaset != this.mimaset2) {
          this.$message.error("输入的密码不一致");
          return false
        }
        axios.post("/api/plan-market/shop/pwd", {
            mobile: this.mimashoujihao,
            sms_code: this.mimacode,
            password: this.mimaset
          })
          .then(response => {
            if (response.data.msg.code == 0) {
              this.$message.success("密码设置成功");
              this.mimasetlog = false
            } else {
              this.$message.error(response.data.msg.info);
            }
          })
      },
      //确认密码下载
      mimaqueren: function() {
        this.daochu()
        // axios.post("/api/plan-market/shop/log/url",{id:this.mimaid,password:this.mima})
        //     .then(response =>{
        //         if(response.data.msg.code == 0){
        //           if(window.location.href.indexOf("91haoka_platform") > -1){
        //             console.log("线上项目，谨慎操作。")
        //             this.url = window.location.origin+"/"
        //           }else{
        //             this.url = ""
        //           }
        //           var a = document.createElement('a');

        //           a.setAttribute('href', this.url+response.data.data.local_filename);
        //           a.click();
        //         }else{
        //             this.$message.error(response.data.msg.info);
        //         }
        //     })
      },
      xiazai: function() {

        //判断有没有密码
        var that = this
        axios.get("/api/plan-market/shop/pwd")
          .then(function(response) {
            if (response.data.msg.code == 0) {
              console.log(response)
              if (response.data.data == "") {
                //要设置密码
                that.mimasetlog = true
              } else {
                //输入密码
                that.mimalog = true
              }
            } else {
              that.$message.error(response.data.msg.info);
            }
          });

        //没有密码设置  有密码下载
        //地址配置,用于下载模板
        // if(window.location.href.indexOf("91haoka_platform") > -1){
        // 	console.log("线上项目，谨慎操作。")
        // 	this.url = window.location.origin+"/"
        // }else{
        // 	this.url = ""
        // }
        // var a = document.createElement('a');

        // a.setAttribute('href', this.url+url);
        // a.click();
      },
      //查看操作记录
      seememo: function(memo) {
        this.memo = memo;
        this.seememolog = true;
      },
      //排序
      shunxu: function() {
        this.loading = true;

        if (this.orderby == 0) {
          this.orderby = 1;
          this.desc = true;
        } else {
          this.orderby = 0;
          this.desc = false;
        }
        this.getlist();
      },
      //获取分销商
      getidslist: function() {
        var that = this;
        axios.get('/api/gth/partner/list?page_size=10000')
          .then(response => {
            if (response.data.msg.code == 0) {
              that.idslist = response.data.data.data
              if (this.$route.query.id) {
                this.search.child_shop_id = this.$route.query.id
              }
            } else {
              if (response.data.msg.code == 50401) {
                that.$router.push({
                  path: "/login"
                });
                return false
              }
              that.$message.error(response.data.msg.info);
            }
          })
      },
      loggo: function() {

      },
      //选择标旗id
      choosecolorid: function(id) {
        this.choose.id = id
      },
      //选择标旗
      choosecolor: function(val) {
        console.log(val)
        axios.post('/api/plan-market/order/flag', {
            color: val,
            id: this.choose.id
          })
          .then(response => {
            this.getlist()
          })

      },

      //点击产品筛选
      changepro: function(e) {
        this.search.product_ids = e
        console.log(this.search.product_ids)
      },
      //搜索更多
      searchelses: function() {
        this.searchelse = true
      },

      //导出
      // daochu: function() {
      //   this.daochuing = true
      //   this.daochuingz = "导出中..."
      //   if (this.search.time == null) {
      //     this.search.start = ""
      //     this.search.end = ""
      //   } else {
      //     if (this.search.time[0] == undefined || this.search.time[0] == null) {
      //       this.search.start = ""
      //     } else {
      //       this.search.start = this.search.time[0]
      //     }
      //     if (this.search.time[1] == undefined || this.search.time[1] == null) {
      //       this.search.end = ""
      //     } else {
      //       this.search.end = this.search.time[1]
      //     }
      //   }

      //   if (this.search.timefix == null) {
      //     this.search.starttime = ""
      //     this.search.endtime = ""
      //   } else {
      //     if (this.search.timefix[0] == undefined || this.search.timefix[0] == null) {
      //       this.search.starttime = ""
      //     } else {
      //       this.search.starttime = this.search.timefix[0]
      //     }
      //     if (this.search.timefix[1] == undefined || this.search.timefix[1] == null) {
      //       this.search.endtime = ""
      //     } else {
      //       this.search.endtime = this.search.timefix[1]
      //     }
      //   }

      //   this.search.product_sku = this.search.product_sku.trim()

      //   this.search.source = this.search.source.trim()
      //   this.search.orderid = this.search.orderid.trim()
      //   this.search.plan_mobile_produced = this.search.plan_mobile_produced.trim()
      //   this.search.id_num = this.search.id_num.trim()
      //   this.search.address_mobile = this.search.address_mobile.trim()
      //   this.search.buy_number = this.search.buy_number.trim()
      //   this.search.source_id = this.search.source_id.trim()
      //   this.search.id_name = this.search.id_name.trim()

      //   var data = {}
      //   data['password'] = this.mima
      //   data['type'] = 4
      //   data['flag'] = 4
      //   data['child_shop_id'] = this.search.child_shop_id
      //   data['end'] = this.search.end
      //   data['start'] = this.search.start
      //   data['status_at_end'] = this.search.order_at_start
      //   data['status_at_start'] = this.search.status_at_start
      //   data['good_sku'] = this.search.product_sku
      //   data['pages_ids'] = this.form.pages_ids
      //   data['product_id'] = this.search.product_id
      //   data['plan_mobile_produced'] = this.search.mobile_produced
      //   data['plan_mobile'] = this.search.buy_number
      //   data['page'] = this.page
      //   data['page_size'] = this.page_size
      //   data['source'] = this.search.source
      //   data['source_id'] = this.search.source_id
      //   data['order_id'] = this.search.orderid
      //   data['card_num'] = this.search.id_card_num
      //   data['card_name'] = this.search.id_name
      //   // data['ids'] = this.search.product_ids

      //   data['plan_mobile_produceds'] = this.duoschminput2
      //   data['ids'] = this.duoxuanids2
      //   data['id_card_nums'] = this.duoxuanidsx

      //   data['address_mobile'] = this.search.address_mobile
      //   data['color'] = this.search.color
      //   data['status'] = this.search.status

      //   axios.post('/api/plan-market/old/order/export', data).then(response => {
      //       if (response.data.msg.code == 0) {
      //         this.daochuing = false
      //         this.daochuingz = "批量导出"
      //         // this.mimalog = false
      //         //2021.3.1全部导出修改
      //         // this.$router.push({
      //         //   path:'/order_export2'
      //         // })
      //         let routeData = this.$router.resolve({
      //         	path: '/order_export2'
      //         });
      //         window.open(routeData.href, '_blank');
      //       } else {
      //         this.$message.error(response.data.msg.info);
      //         this.daochuing = false
      //         this.daochuingz = "批量导出"
      //       }

      //     })

      // },


      //选择省市区
      changeaddress: function(v) {
        this.fixchooselist.address_province = CodeToText[v[0]],
          this.fixchooselist.address_city = CodeToText[v[1]],
          this.fixchooselist.address_district = CodeToText[v[2]]
        console.log("选中的省市区" + this.fixchooselist.address_province + this.fixchooselist.address_city + this
          .fixchooselist.address_district)
      },
      //获取待审核数据
      getlist: function() {
        var that = this
        this.loading = true


        if (this.search.time == null) {
          this.search.start = ""
          this.search.end = ""
        } else {
          if (this.search.time[0] == undefined || this.search.time[0] == null) {
            this.search.start = ""
          } else {
            this.search.start = this.search.time[0]
          }
          if (this.search.time[1] == undefined || this.search.time[1] == null) {
            this.search.end = ""
          } else {
            this.search.end = this.search.time[1]
          }
        }
        if (this.search.timefix == null) {
          this.search.starttime = ""
          this.search.endtime = ""
        } else {
          if (this.search.timefix[0] == undefined || this.search.timefix[0] == null) {
            this.search.starttime = ""
          } else {
            this.search.starttime = this.search.timefix[0]
          }
          if (this.search.timefix[1] == undefined || this.search.timefix[1] == null) {
            this.search.endtime = ""
          } else {
            this.search.endtime = this.search.timefix[1]
          }
        }

        this.search.product_sku = this.search.product_sku.trim()
        this.search.source = this.search.source.trim()
        this.search.orderid = this.search.orderid.trim()
        this.search.plan_mobile_produced = this.search.plan_mobile_produced.trim()
        this.search.id_num = this.search.id_num.trim()
        this.search.address_mobile = this.search.address_mobile.trim()
        this.search.buy_number = this.search.buy_number.trim()
        this.search.source_id = this.search.source_id.trim()
        this.search.id_name = this.search.id_name.trim()

        var url = '/api/plan-market/oldorders?type=2&status_at_end=' + this.search.endtime +
          '&status_at_start=' + this.search.starttime + '&status=' + this.search.status +
          '&end=' + this.search.end + '&start=' + this.search.start +
          '&page=' + this.search.page + '&page_size=' + this.search.size +
          '&product_sku=' + encodeURIComponent(this.search.product_sku) +
          '&pages_ids=' + this.form.pages_ids +
          '&child_shop_id=' + this.search.child_shop_id +
          '&source=' + this.search.source +
          '&orderby=' + this.orderby +
          '&order_id=' + this.search.orderid + '&plan_mobile_produced=' +
          this.search.plan_mobile_produced + '&card_num=' + this.search.id_num + '&address_mobile=' + this
          .search.address_mobile + '&plan_mobile=' + this.search.buy_number +
          '&source_id=' + this.search.source_id + '&card_name=' + this.search.id_name + '&color=' + this.search.color +
          '&ids='+ this.duoxuanids2 + '&plan_mobile_produceds=' + this.duoschminput2 + '&id_card_nums=' + this.duoxuanidsx.toString()

        axios.get(url)
          .then(response => {

            for (var i in response.data.data.data) {
              if (response.data.data.data[i].flag == 0) {
                response.data.data.data[i].flag = "#e4dfd7"
              }
              if (response.data.data.data[i].flag == 1) {
                response.data.data.data[i].flag = "#ee3f4d"
              }
              if (response.data.data.data[i].flag == 2) {
                response.data.data.data[i].flag = "#ebb10d"
              }
              if (response.data.data.data[i].flag == 3) {
                response.data.data.data[i].flag = "#229453"
              }
              if (response.data.data.data[i].flag == 4) {
                response.data.data.data[i].flag = "#2775b6"
              }
              if (response.data.data.data[i].flag == 5) {
                response.data.data.data[i].flag = "#8076a3"
              }
            }
            that.orderlist = response.data.data.data
            that.search.total = response.data.data.total
            that.loading = false
          })
      },

      //筛选字段
      choosezd: function(e) {
        console.log(e)
        localStorage.setItem("shaixuanother", e)

        if (e.indexOf("外部订单编号") > -1) {
          this.show.source_id = true
        } else {
          this.show.source_id = false
        }
        if (e.indexOf("收货地址") > -1) {
          this.show.address = true
        } else {
          this.show.address = false
        }
        if (e.indexOf("联系电话") > -1) {
          this.show.address_mobile = true
        } else {
          this.show.address_mobile = false
        }
        if (e.indexOf("收货人") > -1) {
          this.show.address_name = true
        } else {
          this.show.address_name = false
        }

        if (e.indexOf("下单时间") > -1) {
          this.show.created_at = true
        } else {
          this.show.created_at = false
        }
        if (e.indexOf("ID") > -1) {
          this.show.id = true
        } else {
          this.show.id = false
        }
        if (e.indexOf("证件姓名") > -1) {
          this.show.id_card_name = true
        } else {
          this.show.id_card_name = false
        }

        if (e.indexOf("生产号码") > -1) {
          this.show.plan_mobile_produced = true
        } else {
          this.show.plan_mobile_produced = false
        }
        if (e.indexOf("商品名称") > -1) {
          this.show.product_name = true
        } else {
          this.show.product_name = false
        }
        if (e.indexOf("归属地") > -1) {
          this.show.region_c = true
        } else {
          this.show.region_c = false
        }
        if (e.indexOf("归属地") > -1) {
          this.show.region_p = true
        } else {
          this.show.region_p = false
        }
        if (e.indexOf("操作记录") > -1) {
          this.show.seller_memo = true
        } else {
          this.show.seller_memo = false
        }

        if (e.indexOf("订单状态") > -1) {
          this.show.status = true
        } else {
          this.show.status = false
        }
        if (e.indexOf("物流单号") > -1) {
          this.show.tracking_number = true
        } else {
          this.show.tracking_number = false
        }
        if (e.indexOf("生产备注") > -1) {
          this.show.reason = true
        } else {
          this.show.reason = false
        }
        if (e.indexOf("商品名称") > -1) {
          this.show.product_name = true
        } else {
          this.show.product_name = false
        }

        if (e.indexOf("购买号码") > -1) {
          this.show.plan_mobile = true
        } else {
          this.show.plan_mobile = false
        }
      },
      //单个图片上传
      uploadok: function(file) {
        var that = this;
        var formData = new FormData();
        formData.append("id_num", this.choose.id);
        formData.append("order_id", this.choose.ordernum);
        formData.append("pic[" + this.choose.orderid + "]", file.raw);
        axios.post('/api/ROS/plan/photo/cut', formData)
          .then(response => {
            // 上传到服务器后 获取新图片并清除缓存
            var random = Math.random()
            if (response.data.data.face_url != '') {
              that.choose.face = response.data.data.face_url + '?v=' + random
            } else {
              that.choose.face = ''
            }
            if (response.data.data.back_url != '') {
              that.choose.back = response.data.data.back_url + '?v=' + random
            } else {
              that.choose.back = ''
            }
            if (response.data.data.hand_url != '') {
              that.choose.hand = response.data.data.hand_url + '?v=' + random
            } else {
              that.choose.hand = ''
            }
          })
      },

      //修改状态确认
      fixstatusok: function() {
        //修改的status赋值到提交的字段上面
        if (this.fixchooselist.status == -5010) {
          this.fixstatusid = -5010
        }
        if (this.fixchooselist.status == -460) {
          this.fixstatusid = -460
        }
        if (this.fixchooselist.status == -200) {
          this.fixstatusid = -200
        }
        if (this.fixchooselist.status == -100) {
          this.fixstatusid = -100
        }
        if (this.fixchooselist.status == 0) {
          this.fixstatusid = 0
        }
        if (this.fixchooselist.status == 100) {
          this.fixstatusid = 100
        }
        if (this.fixchooselist.status == 120) {
          this.fixstatusid = 120
        }
        if (this.fixchooselist.status == 150) {
          this.fixstatusid = 150
        }
        if (this.fixchooselist.status == 200) {
          this.fixstatusid = 200
        }
        if (this.fixchooselist.status == 450) {
          this.fixstatusid = 450
        }
        if (this.fixchooselist.status == 460) {
          this.fixstatusid = 460
        }
        if (this.fixchooselist.status == 470) {
          this.fixstatusid = 470
        }
        if (this.fixchooselist.status == 500) {
          this.fixstatusid = 500
        }
        if (this.fixchooselist.status == 550) {
          this.fixstatusid = 550
        }
        if (this.fixchooselist.status == -700) {
          this.fixstatusid = -700
        }
        if (this.fixchooselist.status == 5000) {
          this.fixstatusid = 5000
        }
        if (this.fixchooselist.status == 5010) {
          this.fixstatusid = 5010
        }
        if (this.fixchooselist.status == 5100) {
          this.fixstatusid = 5100
        }
        var that = this
        var params = new URLSearchParams();
        if (this.fixstatusid == -460 || this.fixstatusid == -200 || this.fixstatusid == 0) {
          if (this.fixreasons == "") {
            this.$message.error('请输入原因');
            return false
          }
        }
        params.append('id', this.fixid);
        params.append('status', this.fixstatusid);
        params.append('remark', this.fixreasons);

        axios.post('/api/plan-market/order/status/update', params)
          .then(response => {
            if (response.data.msg.code != 0) {
              this.$message.error(response.data.msg.info);
            } else {
              this.$message({
                message: '修改状态成功',
                type: 'success'
              });
              that.getlist()
              that.fixstatuslog = false
            }
          })
      },
      //搜索功能
      dosearch: function() {
        this.search.page = 1
        this.getlist()
      },
      //翻页功能
      fanye: function(page) {
        console.log(page)
        this.search.page = page
        this.getlist()
      },
      //查看照片 标记出选中的订单id等信息
      seephoto: function(id, ordernum) {

        this.choose.face = ""
        this.choose.back = ""
        this.choose.hand = ""

        this.choose.id = id
        this.choose.ordernum = ordernum

        this.seephotolog = true
        this.seephotoing = true
        var that = this
        axios.get('/api/plan-market/order/photos/url?id_card_num=' + id + '&id=' + ordernum)
          .then(response => {
            if (response.data.data.name != "") {
              that.fixchooselist.product_name = response.data.data.name
              var random = Math.random()
              if (response.data.data.face_url != '') {
                that.choose.face = response.data.data.face_url + '?v=' + random
              } else {
                that.choose.face = ''
              }
              if (response.data.data.back_url != '') {
                that.choose.back = response.data.data.back_url + '?v=' + random
              } else {
                that.choose.back = ''
              }
              if (response.data.data.hand_url != '') {
                that.choose.hand = response.data.data.hand_url + '?v=' + random
              } else {
                that.choose.hand = ''
              }
              that.seephotoing = false

            }
          })
        // var random = Math.random()
        // this.choose.face = "/storage/upload/id_card_photo/"+id+"/face.jpg?v="+random
        // this.choose.back = "/storage/upload/id_card_photo/"+id+"/back.jpg?v="+random
        // this.choose.hand = "/storage/upload/id_card_photo/"+id+"/hand.jpg?v="+random
        // this.seephotolog = true
      },
      //点击上传某张
      fixchoose: function(fbh) {
        this.choose.orderid = fbh
        console.log("正在上传" + fbh + "的照片")
      },
      //实时查询产品
      founditem: function() {
        console.log("正在查询sku为" + this.fixchooselist.sku + "的产品")
        var that = this
        axios.get('/api/ROS/plan/order/select_product?sku=' + this.fixchooselist.sku)
          .then(response => {
            if (response.data.data.name != "") {
              that.fixchooselist.product_name = response.data.data.name
            }
          })
      },
      //选中的id记录
      choosefixid: function(id) {
        console.log("选中id为" + id + "的订单")
        this.fixid = id
        axios.get('/api/plan-market/order/info?order_id=' + id)
          .then(response => {

            if (response.data.msg.code != 0) {
              this.$message.error(response.data.msg.info);
            } else {
              this.fixchooselist = response.data.data

              if (this.fixchooselist.status == -5010) {
                this.fixchooselist.status = "-5010"
              }
              if (this.fixchooselist.status == -460) {
                this.fixchooselist.status = "-460"
              }
              if (this.fixchooselist.status == -200) {
                this.fixchooselist.status = "-200"
              }
              if (this.fixchooselist.status == -100) {
                this.fixchooselist.status = "-100"
              }
              if (this.fixchooselist.status == 0) {
                this.fixchooselist.status = "0"
              }
              if (this.fixchooselist.status == 100) {
                this.fixchooselist.status = '100'
              }
              if (this.fixchooselist.status == 120) {
                this.fixchooselist.status = '120'
              }
              if (this.fixchooselist.status == 150) {
                this.fixchooselist.status = '150'
              }
              if (this.fixchooselist.status == 200) {
                this.fixchooselist.status = '200'
              }
              if (this.fixchooselist.status == 450) {
                this.fixchooselist.status = '450'
              }
              if (this.fixchooselist.status == 460) {
                this.fixchooselist.status = '460'
              }
              if (this.fixchooselist.status == 470) {
                this.fixchooselist.status = '470'
              }
              if (this.fixchooselist.status == 500) {
                this.fixchooselist.status = '500'
              }
              if (this.fixchooselist.status == 550) {
                this.fixchooselist.status = '550'
              }
              if (this.fixchooselist.status == -700) {
                this.fixchooselist.status = '-700'
              }
              if (this.fixchooselist.status == 5000) {
                this.fixchooselist.status = '5000'
              }
              if (this.fixchooselist.status == 5010) {
                this.fixchooselist.status = '5010'
              }
              if (this.fixchooselist.status == 5100) {
                this.fixchooselist.status = '5100'
              }


            }

          })
      },
      //修改
      fix: function(e) {
        if (e == "fixpro") {
          this.fixprolog = true
        }
        if (e == "whitepro") {
          this.whiteprolog = true
        }
        if (e == "fixorder") {
          this.fixorderlog = true
          var city = []
          if (this.fixchooselist.address_province != "") {
            city.push(TextToCode[this.fixchooselist.address_province].code)
          }
          if (this.fixchooselist.address_city != "") {
            city.push(TextToCode[this.fixchooselist.address_province][this.fixchooselist.address_city]
              .code)
          }
          if (this.fixchooselist.address_district != "") {
            city.push(TextToCode[this.fixchooselist.address_province][this.fixchooselist.address_city][this
              .fixchooselist.address_district
            ].code)
          }
          this.fixchooselist.city = city
        }

        if (e == "backpro") {
          this.probacklog = true
          //标记为已退货处理
          // 点确认执行probackok
        }
        if (e == "fast") {
          this.fastlog = true
          //标记为加急
          // 点确认执行fastok
        }
        if (e == "backorder") {
          this.backorderlog = true
          //标记为
          // 点确认执行backorderok
        }
        if (e == "refund") {
          this.$confirm('确定给ID为"' + this.fixchooselist.id + '"的订单执行退款操作吗?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            var that = this
            this.loading = true
            var params = new FormData();
            params.append('id', this.fixchooselist.id);
            axios.post('/api/ROS/plan/order/refund', params)
              .then(response => {
                if (response.data.code != "SUCCESS") {
                  this.$message.error(response.data.msg.info);
                } else {
                  that.$message({
                    type: 'success',
                    message: '已处理退款!'
                  });
                  that.getlist()
                }
                that.loading = false
              })
          })
        }
        if (e == "fixstatus") {
          this.fixreasons = ""

          this.fixstatuslog = true
        }



      },
      //修改信息
      fixorderok: function() {
        var that = this
        var params = new URLSearchParams();

        params.append('id', this.fixid);
        params.append('address_name', this.fixchooselist.address_name);
        params.append('id_card_name', this.fixchooselist.id_card_name);
        params.append('id_card_num', this.fixchooselist.id_card_num);

        params.append('address_province', this.fixchooselist.address_province);
        params.append('address_city', this.fixchooselist.address_city);
        params.append('address_district', this.fixchooselist.address_district);

        params.append('address', this.fixchooselist.address);
        params.append('address_mobile', this.fixchooselist.address_mobile);


        axios.post('/api/plan-market/order/info/update', params)
          .then(response => {
            if (response.data.msg.code != 0) {
              this.$message.error(response.data.msg.info);
            } else {
              that.fixorderlog = false

              console.log(that.fixitemnum)
              this.$message({
                message: '修改状态成功',
                type: 'success'
              });
              that.getlist()
            }
          })
      },
      //修改产品确认
      fixprook: function() {
        var that = this
        var params = new URLSearchParams();

        params.append('id', this.fixid);
        params.append('sku', this.fixchooselist.sku);
        if (this.fixchooselist.sku == "") {
          this.$message.error('请先输入货号');
          return false
        }
        axios.post('/api/plan-market/order/product/update', params)
          .then(response => {
            if (response.data.msg.code != 0) {
              this.$message.error(response.data.msg.info);
            } else {
              that.fixprolog = false
              that.fixitemnum = ""
              this.$message({
                message: '修改状态成功',
                type: 'success'
              });
              that.getlist()
            }
          })
      },
      //修改订单信息
      fixorder: function() {

      },
      //修改生产信息
      whiteprook: function() {
        var that = this
        var params = new URLSearchParams();
        params.append('id', this.fixid);
        params.append('plan_mobile_produced', this.fixchooselist.plan_mobile_produced);
        params.append('tracking_number', this.fixchooselist.tracking_number);
        axios.post('/api/plan-market/order/info/update', params)
          .then(response => {
            if (response.data.msg.code != 0) {
              this.$message.error(response.data.msg.info);
            } else {
              this.probacklog = false
              this.$message({
                message: '录入信息成功',
                type: 'success'
              });
              this.whiteprolog = false
              that.getlist()
            }
          })
      },
      //取消订单
      backorderok: function() {
        var that = this
        var params = new URLSearchParams();
        params.append('id', this.fixid);
        axios.post('/api/plan-market/order/cancel', params)
          .then(response => {
            if (response.data.msg.code != 0) {
              this.$message.error(response.data.msg.info);
            } else {
              this.backorderlog = false
              this.$message({
                message: '修改状态成功',
                type: 'success'
              });
              that.getlist()
            }
          })
      },
      //退货确认
      probackok: function() {
        var that = this
        var params = new URLSearchParams();
        params.append('id', this.fixid);
        params.append('remark', this.backproreason);
        axios.post('/api/plan-market/order/return_product', params)
          .then(response => {
            if (response.data.msg.code != 0) {
              this.$message.error(response.data.msg.info);
            } else {
              this.probacklog = false
              this.$message({
                message: '修改状态成功',
                type: 'success'
              });
              that.getlist()
            }
          })
      },
			goxiazai:function(){
			  // this.$router.push({
			  //   path:'/order_export2'
			  // })
			  let routeData = this.$router.resolve({path: '/order_export2'});
			  window.open(routeData.href, '_blank');
			},
				//重置密码确认
				mimaqueren2:function(){
				  if(this.mimaset != this.mimaset2){
				    this.$message.error("输入的密码不一致");
				    return false
				  }
				  axios.post("/api/plan-market/shop/pwd",{mobile:this.mimashoujihao,sms_code:this.mimacode,password:this.mimaset})
				      .then(response =>{
				          if(response.data.msg.code == 0){
				              this.$message.success("密码设置成功");
				              this.mimachongzhilog = false
				          }else{
				              this.$message.error(response.data.msg.info);
				          }
				      })
				},
				//获取验证码
				getcode:function(){
				  var that = this;
				  var params = new URLSearchParams();
				  params.append('mobile', this.mimashoujihao);
				  axios.post('/api/auth/sms_code', params)
				    .then(response => {
				      if(response.data.msg.code == 0){
				        this.$message({
				          message: '验证码已发送！',
				          type: 'success'
				        });
				        that.daojishi()
				      }else{
				        this.$message.error(response.data.msg.info);
				      }
				    })
				},
				//倒计时功能
				daojishi:function(){
				  var interval;
				  interval = window.setInterval(() => {
				    if(this.count <= 0){
				      window.clearInterval(interval)
				      this.tishi = "获取验证码",
				      this.jinyong = false
				      this.count = 60
				    }else{
				      this.count -= 1;
				      this.tishi = this.count+"秒重新获取"
				      this.jinyong = true
				    }
				  }, 1000);
				},
				//获取手机号发验证码
				getshoujihao:function(){
				  axios.get("/api/gth/my/shop/mobile")
				      .then(response =>{
				          if(response.data.msg.code == 0){
				              this.mimashoujihao = response.data.data
				          }else{
				              this.$message.error(response.data.msg.info);
				          }
				      })
				},
				//密码设置
				mimasetqueren:function(){
				  if(this.mimaset != this.mimaset2){
				    this.$message.error("输入的密码不一致");
				    return false
				  }
				  axios.post("/api/plan-market/shop/pwd",{mobile:this.mimashoujihao,sms_code:this.mimacode,password:this.mimaset})
				      .then(response =>{
				          if(response.data.msg.code == 0){
				              this.$message.success("密码设置成功");
				              this.mimasetlog = false
				          }else{
				              this.$message.error(response.data.msg.info);
				          }
				      })
				},
				//确认密码下载
				mimaqueren:function(){
				  this.daochu()
				  // axios.post("/api/plan-market/shop/log/url",{id:this.mimaid,password:this.mima})
				  //     .then(response =>{
				  //         if(response.data.msg.code == 0){
				  //           if(window.location.href.indexOf("91haoka_platform") > -1){
				  //             console.log("线上项目，谨慎操作。")
				  //             this.url = window.location.origin+"/"
				  //           }else{
				  //             this.url = ""
				  //           }
				  //           var a = document.createElement('a');

				  //           a.setAttribute('href', this.url+response.data.data.local_filename);
				  //           a.click();
				  //         }else{
				  //             this.$message.error(response.data.msg.info);
				  //         }
				  //     })
				},
				xiazai:function(){

				  //判断有没有密码
				  var that = this
				  axios.get("/api/plan-market/shop/pwd")
				    .then(function(response) {
				        if(response.data.msg.code == 0){
				              console.log(response)
				              if(response.data.data == ""){
				                //要设置密码
				                that.mimasetlog = true
				              }else{
				                //输入密码
				                that.mimalog = true
				              }
				        }else{
				              that.$message.error(response.data.msg.info);
				        }
				    });

				  //没有密码设置  有密码下载
				    //地址配置,用于下载模板
				    // if(window.location.href.indexOf("91haoka_platform") > -1){
				    // 	console.log("线上项目，谨慎操作。")
				    // 	this.url = window.location.origin+"/"
				    // }else{
				    // 	this.url = ""
				    // }
				    // var a = document.createElement('a');

				    // a.setAttribute('href', this.url+url);
				    // a.click();
				},
			//查看操作记录
			seememo: function(memo) {
				this.memo = memo;
				this.seememolog = true;
			},
			//排序
			shunxu: function() {
				this.loading = true;

				if (this.orderby == 0) {
					this.orderby = 1;
					this.desc = true;
				} else {
					this.orderby = 0;
					this.desc = false;
				}
				this.getlist();
			},
			//获取分销商
			getidslist: function() {
				var that = this;
				axios.get('/api/gth/partner/list?page_size=10000')
					.then(response => {
						if (response.data.msg.code == 0) {
							that.idslist = response.data.data.data
							if (this.$route.query.id) {
								this.search.child_shop_id = this.$route.query.id
							}
						} else {
							if (response.data.msg.code == 50401) {
								that.$router.push({
									path: "/login"
								});
								return false
							}
							that.$message.error(response.data.msg.info);
						}
					})
			},
			loggo: function() {

			},
			//选择标旗id
			choosecolorid: function(id) {
				this.choose.id = id
			},
			//选择标旗
			choosecolor: function(val) {
				console.log(val)
				axios.post('/api/plan-market/order/flag', {
						color: val,
						id: this.choose.id
					})
					.then(response => {
						this.getlist()
					})

			},
			//复制功能
			copy: function(t) {
				var that = this
        t= t.toString()
				this.$copyText(t)
					.then(
						res => {
							that.$message.success("复制成功");
						}
					);
				console.log(t)
			},
			//点击产品筛选
			changepro: function(e) {
				this.search.product_ids = e
				console.log(this.search.product_ids)
			},
			//搜索更多
			searchelses: function() {
				this.searchelse = true
			},

			//导出
			daochu: function(item) {
				this.daochuing = true
				this.daochuingz = "导出中..."
				if (this.search.time == null) {
					this.search.start = ""
					this.search.end = ""
				} else {
					if (this.search.time[0] == undefined || this.search.time[0] == null) {
						this.search.start = ""
					} else {
						this.search.start = this.search.time[0]
					}
					if (this.search.time[1] == undefined || this.search.time[1] == null) {
						this.search.end = ""
					} else {
						this.search.end = this.search.time[1]
					}
				}

				if (this.search.timefix == null) {
					this.search.starttime = ""
					this.search.endtime = ""
				} else {
					if (this.search.timefix[0] == undefined || this.search.timefix[0] == null) {
						this.search.starttime = ""
					} else {
						this.search.starttime = this.search.timefix[0]
					}
					if (this.search.timefix[1] == undefined || this.search.timefix[1] == null) {
						this.search.endtime = ""
					} else {
						this.search.endtime = this.search.timefix[1]
					}
				}

				this.search.product_sku = this.search.product_sku.trim()
				this.search.source = this.search.source.trim()
				this.search.orderid = this.search.orderid.trim()
				this.search.plan_mobile_produced = this.search.plan_mobile_produced.trim()
				this.search.id_num = this.search.id_num.trim()
				this.search.address_mobile = this.search.address_mobile.trim()
				this.search.buy_number = this.search.buy_number.trim()
				this.search.source_id = this.search.source_id.trim()
				this.search.id_name = this.search.id_name.trim()

				var data = {}
				data['password'] = this.mima
				data['type'] = 4
				data['flag'] = 4
				data['child_shop_id'] = this.search.child_shop_id
				data['end'] = this.search.end
				data['start'] = this.search.start
				data['status_at_end'] = this.search.order_at_start
				data['status_at_start'] = this.search.status_at_start
				data['good_sku'] = this.search.product_sku
        data['pages_ids'] = this.form.pages_ids

				data['product_id'] = this.search.product_id
				data['plan_mobile_produced'] = this.search.mobile_produced
				data['plan_mobile'] = this.search.buy_number
				data['page'] = this.search.page
				data['page_size'] = this.search.page_size
				data['source'] = this.search.source
				data['source_id'] = this.search.source_id
				data['order_id'] = this.search.orderid
				data['card_num'] = this.search.id_card_num
				data['card_name'] = this.search.id_name
				data['plan_mobile_produceds'] = this.duoschminput2
				data['ids'] = this.duoxuanids2
				data['address_mobile'] = this.search.address_mobile
				data['color'] = this.search.color
				data['status'] = this.search.status
        data['id_card_nums'] = this.duoxuanidsx.toString()
        data['model_id'] = item.act
        data['item_ids'] = item.arr
        data['is_old'] = 1
        data['type'] = 2

				axios.post('/api/plan-market/order/export/new', data).then(response => {
					if (response.data.msg.code == 0) {
						this.daochuing = false
						this.daochuingz = "批量导出"
						// this.mimalog = false
						//2021.3.1全部导出修改
						// this.$router.push({
						//   path:'/order_export2'
						// })
						let routeData = this.$router.resolve({
							path: '/order_export2'
						});
						window.open(routeData.href, '_blank');
					} else {
						this.$message.error(response.data.msg.info);
						this.daochuing = false
						this.daochuingz = "批量导出"
					}

				})

			},


			//选择省市区
			changeaddress: function(v) {
				this.fixchooselist.address_province = CodeToText[v[0]],
					this.fixchooselist.address_city = CodeToText[v[1]],
					this.fixchooselist.address_district = CodeToText[v[2]]
				console.log("选中的省市区" + this.fixchooselist.address_province + this.fixchooselist.address_city + this
					.fixchooselist.address_district)
			},
			//获取待审核数据
			getlist: function() {
				var that = this
				this.loading = true


				if (this.search.time == null) {
					this.search.start = ""
					this.search.end = ""
				} else {
					if (this.search.time[0] == undefined || this.search.time[0] == null) {
						this.search.start = ""
					} else {
						this.search.start = this.search.time[0]
					}
					if (this.search.time[1] == undefined || this.search.time[1] == null) {
						this.search.end = ""
					} else {
						this.search.end = this.search.time[1]
					}
				}
				if (this.search.timefix == null) {
					this.search.starttime = ""
					this.search.endtime = ""
				} else {
					if (this.search.timefix[0] == undefined || this.search.timefix[0] == null) {
						this.search.starttime = ""
					} else {
						this.search.starttime = this.search.timefix[0]
					}
					if (this.search.timefix[1] == undefined || this.search.timefix[1] == null) {
						this.search.endtime = ""
					} else {
						this.search.endtime = this.search.timefix[1]
					}
				}

				this.search.product_sku = this.search.product_sku.trim()
				this.search.source = this.search.source.trim()
				this.search.orderid = this.search.orderid.trim()
				this.search.plan_mobile_produced = this.search.plan_mobile_produced.trim()
				this.search.id_num = this.search.id_num.trim()
				this.search.address_mobile = this.search.address_mobile.trim()
				this.search.buy_number = this.search.buy_number.trim()
				this.search.source_id = this.search.source_id.trim()
				this.search.id_name = this.search.id_name.trim()

				var url = '/api/plan-market/oldorders?type=2&status_at_end=' + this.search.endtime +
					'&status_at_start=' + this.search.starttime + '&status=' + this.search.status +
					'&end=' + this.search.end + '&start=' + this.search.start +
					'&page=' + this.search.page + '&page_size=' + this.search.size +
					'&product_sku=' + encodeURIComponent(this.search.product_sku) +
          '&pages_ids=' + this.form.pages_ids +
					'&child_shop_id=' + this.search.child_shop_id +
					'&source=' + this.search.source +
					'&orderby=' + this.orderby +
					'&order_id=' + this.search.orderid + '&plan_mobile_produced=' +
					this.search.plan_mobile_produced + '&card_num=' + this.search.id_num + '&address_mobile=' + this
					.search.address_mobile + '&plan_mobile=' + this.search.buy_number +
					'&source_id=' + this.search.source_id + '&card_name=' + this.search.id_name + '&color=' + this.search.color + '&ids='+ this.duoxuanids2 + '&plan_mobile_produceds=' + this.duoschminput2 + '&id_card_nums=' + this.duoxuanidsx.toString()


				axios.get(url)
					.then(response => {

						for (var i in response.data.data.data) {
							if (response.data.data.data[i].flag == 0) {
								response.data.data.data[i].flag = "#e4dfd7"
							}
							if (response.data.data.data[i].flag == 1) {
								response.data.data.data[i].flag = "#ee3f4d"
							}
							if (response.data.data.data[i].flag == 2) {
								response.data.data.data[i].flag = "#ebb10d"
							}
							if (response.data.data.data[i].flag == 3) {
								response.data.data.data[i].flag = "#229453"
							}
							if (response.data.data.data[i].flag == 4) {
								response.data.data.data[i].flag = "#2775b6"
							}
							if (response.data.data.data[i].flag == 5) {
								response.data.data.data[i].flag = "#8076a3"
							}
						}
						that.orderlist = response.data.data.data
						// that.search.total = response.data.data.total
						that.loading = false
					})
			},

			//筛选字段
			choosezd: function(e) {
				console.log(e)
				localStorage.setItem("shaixuanother", e)

				if (e.indexOf("外部订单编号") > -1) {
					this.show.source_id = true
				} else {
					this.show.source_id = false
				}
				if (e.indexOf("收货地址") > -1) {
					this.show.address = true
				} else {
					this.show.address = false
				}
				if (e.indexOf("联系电话") > -1) {
					this.show.address_mobile = true
				} else {
					this.show.address_mobile = false
				}
				if (e.indexOf("收货人") > -1) {
					this.show.address_name = true
				} else {
					this.show.address_name = false
				}

				if (e.indexOf("下单时间") > -1) {
					this.show.created_at = true
				} else {
					this.show.created_at = false
				}
				if (e.indexOf("ID") > -1) {
					this.show.id = true
				} else {
					this.show.id = false
				}
				if (e.indexOf("证件姓名") > -1) {
					this.show.id_card_name = true
				} else {
					this.show.id_card_name = false
				}

				if (e.indexOf("生产号码") > -1) {
					this.show.plan_mobile_produced = true
				} else {
					this.show.plan_mobile_produced = false
				}
				if (e.indexOf("商品名称") > -1) {
					this.show.product_name = true
				} else {
					this.show.product_name = false
				}
				if (e.indexOf("归属地") > -1) {
					this.show.region_c = true
				} else {
					this.show.region_c = false
				}
				if (e.indexOf("归属地") > -1) {
					this.show.region_p = true
				} else {
					this.show.region_p = false
				}
				if (e.indexOf("操作记录") > -1) {
					this.show.seller_memo = true
				} else {
					this.show.seller_memo = false
				}

				if (e.indexOf("订单状态") > -1) {
					this.show.status = true
				} else {
					this.show.status = false
				}
				if (e.indexOf("物流单号") > -1) {
					this.show.tracking_number = true
				} else {
					this.show.tracking_number = false
				}
				if (e.indexOf("生产备注") > -1) {
					this.show.reason = true
				} else {
					this.show.reason = false
				}
				if (e.indexOf("商品名称") > -1) {
					this.show.product_name = true
				} else {
					this.show.product_name = false
				}

				if (e.indexOf("购买号码") > -1) {
					this.show.plan_mobile = true
				} else {
					this.show.plan_mobile = false
				}
			},
			//单个图片上传
			uploadok: function(file) {
				var that = this;
				var formData = new FormData();
				formData.append("id_num", this.choose.id);
				formData.append("order_id", this.choose.ordernum);
				formData.append("pic[" + this.choose.orderid + "]", file.raw);
				axios.post('/api/ROS/plan/photo/cut', formData)
					.then(response => {
						// 上传到服务器后 获取新图片并清除缓存
						var random = Math.random()
						if (response.data.data.face_url != '') {
							that.choose.face = response.data.data.face_url + '?v=' + random
						} else {
							that.choose.face = ''
						}
						if (response.data.data.back_url != '') {
							that.choose.back = response.data.data.back_url + '?v=' + random
						} else {
							that.choose.back = ''
						}
						if (response.data.data.hand_url != '') {
							that.choose.hand = response.data.data.hand_url + '?v=' + random
						} else {
							that.choose.hand = ''
						}
					})
			},

			//修改状态确认
			fixstatusok: function() {
				//修改的status赋值到提交的字段上面
				if (this.fixchooselist.status == -5010) {
					this.fixstatusid = -5010
				}
				if (this.fixchooselist.status == -460) {
					this.fixstatusid = -460
				}
				if (this.fixchooselist.status == -200) {
					this.fixstatusid = -200
				}
				if (this.fixchooselist.status == -100) {
					this.fixstatusid = -100
				}
				if (this.fixchooselist.status == 0) {
					this.fixstatusid = 0
				}
				if (this.fixchooselist.status == 100) {
					this.fixstatusid = 100
				}
				if (this.fixchooselist.status == 120) {
					this.fixstatusid = 120
				}
				if (this.fixchooselist.status == 150) {
					this.fixstatusid = 150
				}
				if (this.fixchooselist.status == 200) {
					this.fixstatusid = 200
				}
				if (this.fixchooselist.status == 450) {
					this.fixstatusid = 450
				}
				if (this.fixchooselist.status == 460) {
					this.fixstatusid = 460
				}
				if (this.fixchooselist.status == 470) {
					this.fixstatusid = 470
				}
				if (this.fixchooselist.status == 500) {
					this.fixstatusid = 500
				}
				if (this.fixchooselist.status == 550) {
					this.fixstatusid = 550
				}
				if (this.fixchooselist.status == -700) {
					this.fixstatusid = -700
				}
				if (this.fixchooselist.status == 5000) {
					this.fixstatusid = 5000
				}
				if (this.fixchooselist.status == 5010) {
					this.fixstatusid = 5010
				}
				if (this.fixchooselist.status == 5100) {
					this.fixstatusid = 5100
				}
				var that = this
				var params = new URLSearchParams();
				if (this.fixstatusid == -460 || this.fixstatusid == -200 || this.fixstatusid == 0) {
					if (this.fixreasons == "") {
						this.$message.error('请输入原因');
						return false
					}
				}
				params.append('id', this.fixid);
				params.append('status', this.fixstatusid);
				params.append('remark', this.fixreasons);

				axios.post('/api/plan-market/order/status/update', params)
					.then(response => {
						if (response.data.msg.code != 0) {
							this.$message.error(response.data.msg.info);
						} else {
							this.$message({
								message: '修改状态成功',
								type: 'success'
							});
							that.getlist()
							that.fixstatuslog = false
						}
					})
			},
			//搜索功能
			dosearch: function() {
				this.search.page = 1
				this.getlist()
			},
			//翻页功能
			fanye: function(page) {
				console.log(page)
				this.search.page = page
				this.getlist()
			},
			//查看照片 标记出选中的订单id等信息

			seephoto: function(item) {
        this.jiemi(item)
				this.choose.face = ""
				this.choose.back = ""
				this.choose.hand = ""

				this.choose.id = item.id_card_num
				this.choose.ordernum = item.id

				this.seephotolog = true
				this.seephotoing = true
				var that = this
				axios.get('/api/plan-market/order/photos/url?id_card_num=' + item.id_card_num + '&id=' + item.id)
					.then(response => {
						if (response.data.data.name != "") {
							that.fixchooselist.product_name = response.data.data.name
							var random = Math.random()
							if (response.data.data.face_url != '') {
								that.choose.face = response.data.data.face_url + '?v=' + random
							} else {
								that.choose.face = ''
							}
							if (response.data.data.back_url != '') {
								that.choose.back = response.data.data.back_url + '?v=' + random
							} else {
								that.choose.back = ''
							}
							if (response.data.data.hand_url != '') {
								that.choose.hand = response.data.data.hand_url + '?v=' + random
							} else {
								that.choose.hand = ''
							}
							that.seephotoing = false

						}
					})
				// var random = Math.random()
				// this.choose.face = "/storage/upload/id_card_photo/"+id+"/face.jpg?v="+random
				// this.choose.back = "/storage/upload/id_card_photo/"+id+"/back.jpg?v="+random
				// this.choose.hand = "/storage/upload/id_card_photo/"+id+"/hand.jpg?v="+random
				// this.seephotolog = true
			},
			//点击上传某张
			fixchoose: function(fbh) {
				this.choose.orderid = fbh
				console.log("正在上传" + fbh + "的照片")
			},
			//实时查询产品
			founditem: function() {
				console.log("正在查询sku为" + this.fixchooselist.sku + "的产品")
				var that = this
				axios.get('/api/ROS/plan/order/select_product?sku=' + this.fixchooselist.sku)
					.then(response => {
						if (response.data.data.name != "") {
							that.fixchooselist.product_name = response.data.data.name
						}
					})
			},
			//选中的id记录
			choosefixid: function(id) {
				console.log("选中id为" + id + "的订单")
				this.fixid = id
				axios.get('/api/plan-market/order/info?order_id=' + id)
					.then(response => {

						if (response.data.msg.code != 0) {
							this.$message.error(response.data.msg.info);
						} else {
							this.fixchooselist = response.data.data

							if (this.fixchooselist.status == -5010) {
								this.fixchooselist.status = "-5010"
							}
							if (this.fixchooselist.status == -460) {
								this.fixchooselist.status = "-460"
							}
							if (this.fixchooselist.status == -200) {
								this.fixchooselist.status = "-200"
							}
							if (this.fixchooselist.status == -100) {
								this.fixchooselist.status = "-100"
							}
							if (this.fixchooselist.status == 0) {
								this.fixchooselist.status = "0"
							}
							if (this.fixchooselist.status == 100) {
								this.fixchooselist.status = '100'
							}
							if (this.fixchooselist.status == 120) {
								this.fixchooselist.status = '120'
							}
							if (this.fixchooselist.status == 150) {
								this.fixchooselist.status = '150'
							}
							if (this.fixchooselist.status == 200) {
								this.fixchooselist.status = '200'
							}
							if (this.fixchooselist.status == 450) {
								this.fixchooselist.status = '450'
							}
							if (this.fixchooselist.status == 460) {
								this.fixchooselist.status = '460'
							}
							if (this.fixchooselist.status == 470) {
								this.fixchooselist.status = '470'
							}
							if (this.fixchooselist.status == 500) {
								this.fixchooselist.status = '500'
							}
							if (this.fixchooselist.status == 550) {
								this.fixchooselist.status = '550'
							}
							if (this.fixchooselist.status == -700) {
								this.fixchooselist.status = '-700'
							}
							if (this.fixchooselist.status == 5000) {
								this.fixchooselist.status = '5000'
							}
							if (this.fixchooselist.status == 5010) {
								this.fixchooselist.status = '5010'
							}
							if (this.fixchooselist.status == 5100) {
								this.fixchooselist.status = '5100'
							}


						}

					})
			},
			//修改
			fix: function(e) {
				if (e == "fixpro") {
					this.fixprolog = true
				}
				if (e == "whitepro") {
					this.whiteprolog = true
				}
				if (e == "fixorder") {
					this.fixorderlog = true
					var city = []
					if (this.fixchooselist.address_province != "") {
						city.push(TextToCode[this.fixchooselist.address_province].code)
					}
					if (this.fixchooselist.address_city != "") {
						city.push(TextToCode[this.fixchooselist.address_province][this.fixchooselist.address_city]
							.code)
					}
					if (this.fixchooselist.address_district != "") {
						city.push(TextToCode[this.fixchooselist.address_province][this.fixchooselist.address_city][this
							.fixchooselist.address_district
						].code)
					}
					this.fixchooselist.city = city
				}

				if (e == "backpro") {
					this.probacklog = true
					//标记为已退货处理
					// 点确认执行probackok
				}
				if (e == "fast") {
					this.fastlog = true
					//标记为加急
					// 点确认执行fastok
				}
				if (e == "backorder") {
					this.backorderlog = true
					//标记为
					// 点确认执行backorderok
				}
				if (e == "refund") {
					this.$confirm('确定给ID为"' + this.fixchooselist.id + '"的订单执行退款操作吗?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						var that = this
						this.loading = true
						var params = new FormData();
						params.append('id', this.fixchooselist.id);
						axios.post('/api/ROS/plan/order/refund', params)
							.then(response => {
								if (response.data.code != "SUCCESS") {
									this.$message.error(response.data.msg.info);
								} else {
									that.$message({
										type: 'success',
										message: '已处理退款!'
									});
									that.getlist()
								}
								that.loading = false
							})
					})
				}
				if (e == "fixstatus") {
					this.fixreasons = ""

					this.fixstatuslog = true
				}



			},
			//修改信息
			fixorderok: function() {
				var that = this
				var params = new URLSearchParams();

				params.append('id', this.fixid);
				params.append('address_name', this.fixchooselist.address_name);
				params.append('id_card_name', this.fixchooselist.id_card_name);
				params.append('id_card_num', this.fixchooselist.id_card_num);

				params.append('address_province', this.fixchooselist.address_province);
				params.append('address_city', this.fixchooselist.address_city);
				params.append('address_district', this.fixchooselist.address_district);

				params.append('address', this.fixchooselist.address);
				params.append('address_mobile', this.fixchooselist.address_mobile);


				axios.post('/api/plan-market/order/info/update', params)
					.then(response => {
						if (response.data.msg.code != 0) {
							this.$message.error(response.data.msg.info);
						} else {
							that.fixorderlog = false

							console.log(that.fixitemnum)
							this.$message({
								message: '修改状态成功',
								type: 'success'
							});
							that.getlist()
						}
					})
			},
			//修改产品确认
			fixprook: function() {
				var that = this
				var params = new URLSearchParams();

				params.append('id', this.fixid);
				params.append('sku', this.fixchooselist.sku);
				if (this.fixchooselist.sku == "") {
					this.$message.error('请先输入货号');
					return false
				}
				axios.post('/api/plan-market/order/product/update', params)
					.then(response => {
						if (response.data.msg.code != 0) {
							this.$message.error(response.data.msg.info);
						} else {
							that.fixprolog = false
							that.fixitemnum = ""
							this.$message({
								message: '修改状态成功',
								type: 'success'
							});
							that.getlist()
						}
					})
			},
			//修改订单信息
			fixorder: function() {

			},
			//修改生产信息
			whiteprook: function() {
				var that = this
				var params = new URLSearchParams();
				params.append('id', this.fixid);
				params.append('plan_mobile_produced', this.fixchooselist.plan_mobile_produced);
				params.append('tracking_number', this.fixchooselist.tracking_number);
				axios.post('/api/plan-market/order/info/update', params)
					.then(response => {
						if (response.data.msg.code != 0) {
							this.$message.error(response.data.msg.info);
						} else {
							this.probacklog = false
							this.$message({
								message: '录入信息成功',
								type: 'success'
							});
							this.whiteprolog = false
							that.getlist()
						}
					})
			},
			//取消订单
			backorderok: function() {
				var that = this
				var params = new URLSearchParams();
				params.append('id', this.fixid);
				axios.post('/api/plan-market/order/cancel', params)
					.then(response => {
						if (response.data.msg.code != 0) {
							this.$message.error(response.data.msg.info);
						} else {
							this.backorderlog = false
							this.$message({
								message: '修改状态成功',
								type: 'success'
							});
							that.getlist()
						}
					})
			},
			//退货确认
			probackok: function() {
				var that = this
				var params = new URLSearchParams();
				params.append('id', this.fixid);
				params.append('remark', this.backproreason);
				axios.post('/api/plan-market/order/return_product', params)
					.then(response => {
						if (response.data.msg.code != 0) {
							this.$message.error(response.data.msg.info);
						} else {
							this.probacklog = false
							this.$message({
								message: '修改状态成功',
								type: 'success'
							});
							that.getlist()
						}
					})
			},
			//加急处理
			fastok: function() {
				var that = this
				var params = new URLSearchParams();
				params.append('id', this.fixid);
				axios.post('/api/plan-market/order/accelerate', params)
					.then(response => {
						if (response.data.msg.code != 0) {
							this.$message.error(response.data.msg.info);
						} else {
							this.fastlog = false
							this.$message({
								message: '修改状态成功',
								type: 'success'
							});
						}
					})
			},
      //调到商品详情
			todetail(id){
				console.log('000')
				window.open(window.location.origin +  window.location.pathname+"#/productionDelivery/shopdetail?id="+id)
			},
      //投诉
			opents(id){
					this.isshowwindow = true;
					this.tousuid = id
			},
      //投诉子集传来关闭
			creategd(){
				this.isshowwindow = false
        this.getlist();
				console.log('投诉子集传来关闭')
			},
      creategdhide(){
				this.isshowwindow = false
			},
      //投诉进详情
			todetail_s(id,status){
        // if(status==2){
					//处理完成
					this.$router.push({
						path: '/tousugongdan/checkts',
						query:{id:id,tab:8}
					})
				// }else{
        //   //处理
        //   axios.post('/api/plan-market/admin/complaint/job/update/handler',{
        //     id:id,
        //     status:1
        //   })
        //   .then(response => {
        //     if (response.data.msg.code == 0) {
        //       this.$router.push({
        //       path: '/tousugongdan/checkts',
        //       query:{id:id,tab:8}
        //       })
        //     } else {
        //       this.$message.error(response.data.msg.info);
        //     }
        //   })
        // }

			}
		}
	};
</script>

<style lang="scss" scoped>
  /deep/ .el-button--danger {
      color: #FFF;
      background-color: #2974FF;
      border-color: #2974FF;
  }
  /deep/ .el-button--danger.is-plain {
      color: #18A0FB !important;
      background: #EEF7FF !important;
      border-color: #18A0FB !important;
  }
  .index {
    /deep/ .el-form-item {
      margin-bottom: 10px;
    }


        .o_ul {
          background: #F9F9F9;
          display: flex;

          .o_li {
            flex-basis: 160px;
            line-height: 45px;
            display: block;
            color: #727272;
            border-top: 3px #F9F9F9 solid;
            font-size: 14px;
            text-align: center;
          }

          .act {
            border-top: 3px #DD2727 solid;
            background: #FFFFFF;
          }
        }

        .newflex {
          display: flex;
          justify-content: space-between;
        }

        .newlist {
          .newleft {
            display: flex;
            width: 100%;
          }

          .newthli {
            text-align: center;
            font-size: 14px;
            line-height: 40px;
            height: 40px;
            background: #f9f9f9;
            color: #646464;
            flex:1;
          }


          .newright {
            flex-basis: 116px;
            text-align: center;
          }

          .newh {
            display: flex;
            justify-content: space-between;
            background: #f3faff;
            line-height: 48px;
            height: 48px;
            color: #646464;
            font-size: 13px;
            border: 1px #eaeaea solid;

            .newhli {
              margin-right: 10px;

              /deep/ .el-icon-document-copy {
                margin-left: 0 !important;
              }

              img {
                width: 20px;
                position: relative;
                top: 2px;
                cursor: pointer;
              }
            }

            .newhli:nth-child(1) {
              padding-left: 10px;
              text-align: center;
            }
          }

          .newb {
            display: flex;
            font-size: 14px;
            color: #646464;
            line-height: 25px;
            margin-bottom: 10px;
            border: 1px #eaeaea solid;

            .newt1 {
              flex: 1;
              border-right: 1px #eaeaea solid;

            }

            .newt2 {
             flex: 1;
             border-right: 1px #eaeaea solid;
            }

            .seephoto {
              color: #2775b6;
              cursor: pointer;
            }

            .newt3 {
              flex: 1;
              border-right: 1px #eaeaea solid;
            }

            .newt4 {
              flex: 1;
              border-right: 1px #eaeaea solid;

              .newcar {
                max-height: 80px;
                overflow: hidden;
              }

              .newcar2 {
                color: #2775b6;
                cursor: pointer;
              }
            }

            .newt5 {
             flex: 1;
             border-right: 1px #eaeaea solid;
            }

          }
        }


    .processing {
      width: 100%;
      overflow: hidden;
      background: #FFFFFF;
    }

    .eaeaea {
      background: #E5E5E5;
    }

    .orderflex {
      display: flex;
    }


    .pro_top {
      padding: 20px;
      position: relative;

      /deep/ .el-form-item {
        margin-bottom: 20px;
      }

      /deep/ .el-form-item__label {
        font-size: 14px;

      }



      /deep/ .el-form-item__content {

      }

      /deep/ .el-input__inner {
      width: 220px;
              }

      /deep/ .el-input__icon {

      }
    }

    .rtm {
      position: absolute;
      right: 10px;
      bottom: 10px;
    }

    .ordersub {
      padding-left: 90px;
      padding-top: 10px;


    }

    .list {
      color: #727272;
    }

    .orderlist {
      margin: 20px 0;
      width: 100%;
      overflow: auto;
      white-space: nowrap;
      position: relative;
      padding-bottom: 50px;
    }

    .list .th {
      background: #E5E5E5;
      line-height: 45px;
      font-size: 14px;
      display: inline-block;
      width: 130px;
      margin: 0;
      text-align: center;
    }

    .list .td {
      line-height: 45px;
      height: 45px;
      display: inline-block;
      width: 130px;
      font-size: 14px;
      overflow: hidden;
      margin: 0;
      text-align: center;
    }

    .list .td span {
      margin: 0 5px;
      color: #197CFF;
      cursor: pointer;
    }

    .list .el-dropdown-link {
      font-size: 14px;
    }

    .orderfanye {
      position: absolute;
      right: 10px;
      bottom: 10px;
    }

    .logflex {
      display: flex;
      justify-content: space-around;
      flex-wrap: wrap;
    }

    .logflex div {
      width: 377px;
      text-align: center;
    }

    .logflex .proimg {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 400px;
      background: #EAEAEA;
    }

    .logflex .proimg img {
      max-width: 100%;
      max-height: 100%;
    }

    .protitle {
      color: #197CFF;
      cursor: pointer;
      margin-top: 20px;
    }

    .propipei {
      padding-left: 90px;
      font-size: 14px;
      margin-bottom: 20px;
    }

    .propipei span {
      margin: 0 10px;
      color: #FF5053;
    }

    .colorli {
      display: flex;
      width: 100px;
    }

    .colorli div {
      flex: 1;
      justify-content: space-between;
      line-height: 34px;
      text-align: center;
    }

    .colorname {
      width: 60px;
      height: 24px;
      padding: 5px 20px;
    }
    .orderflex .el-form-item__label {
      font-size: 14px;
    }

    .orderflex input {
      width: 190px;
    }

    .log input {
      width: 300px;
    }
  }
  .t_su{
		background-color: #AF0000;
		color: white;
		width: 26px;
		height: 26px;
		text-align: center;
		line-height: 26px;
		border-radius: 3px;
		cursor: pointer;
		margin-top:12px ;
		// position: absolute;
		// top: 12px;
		// right: 15px;
	}
</style>
